package tedu.study.day06_2;

public class MethodDemo {
    public static void main(String[] args) {
        //say();
        //say();
        //System.out.println("继续执行");
        /*sayHi("zhangsan");
        sayHi("lisi");
        System.out.println("继续执行");
        sayHello("法外狂徒张三",1);
        sayHello("wangwu",10);

        double a = getNum();
        System.out.println(a);

        int n=6,m=9;
        int num = plus(n,m);
        System.out.println(num);*/

        //sayHello("法外狂徒张三",1);
        //sayHello("wangwu",10);

        /*int[] a = createArray(10,20,5);
        System.out.println(a.length);

        int[] b = createArray(8,50,0);
        System.out.println(Arrays.toString(b));
        System.out.println(b[0]);
        for(int i=0;i<b.length;i++){
            System.out.println(b[i]);
        }*/
        aMethod();
        System.out.println(444);

    }

    public static void aMethod(){
        System.out.println(111);
        bMethod();
        System.out.println(222);
    }

    public static void bMethod(){
        System.out.println(333);
    }


    /**
     *
     * @param length 创建数组长度
     * @param max 数组元素随机数的范围值，例0~100，则写入100
     * @param num 数组元素的最小值
     * @return
     */
    public static int[] createArray(int length,int max,int num){
        int[] arr = new int[length];
        for(int i=0;i<arr.length;i++){
            arr[i] = (int)(Math.random()*(max+1))+num;
        }
        return arr;
    }


    public static int plus(int num1,int num2){
        int num = num1 + num2;
        return num;
    }

    public static double getNum(){
        return 8.88;
    }

    public static void sayHello(String name,int num){
        if(num<5){
            System.out.println(name+"买的太少，不送");
            return;
        }
        System.out.println("大家好，我是"+name+"，前来送行，买"+num+"送一！");
    }

    public static void sayHi(String name){
        System.out.println("大家好，我是"+name+"，前来送行，买一送一！");
    }

    public static void say(){
        System.out.println("大家好，我是胡桃，前来送行，买一送一！");
    }
}
